<?php
session_start();
include "Includes/solotrn_sesion.php";
include "Includes/soloFun_Generales.php";
require_once "config.php";
require_once "Includes/conexion.class.php";

$CboNodo = $_REQUEST["CboNodo"];
$CboNodo = 1;
$pageaction = "solotrn_AdministrarTransaccion.php";
//'TopNodo = ObtenerPrimerNodosql
//'if CboNodo = "" then CboNodo = TopNodo	'si es blanco le asigno el primer valor
//'StrCboNodo = Cargar_nodo_usuariosql(CboNodo, "CboNodo", "style='width:226' onChange='Sumitirform();'")
$TopNodo = 1;
if (empty($CboNodo)) $CboNodo = $TopNodo; //'si es blanco le asigno el primer valor

SoloFun_ExecSql ("select * from solotb_nivel1", $SoloArrNodos);
$StrCboNodo = SoloFun_CargaCombo($SoloArrNodos,"CboNodo","$CboDisabled",$itemselec," class='SoloStyle_Texto' style='width:200px'","");

/******************Consulta Modulos***************************/
$strSql = "select * from solotb_modulo where nodo= $CboNodo order by ds_modu";
SoloFun_ExecSql ($strSql, $ArrModu);
$itemselec = $_REQUEST["CmbModulo"];
if ($itemselec == "") $itemselec = "1";
//'rw"",itemselec
$StrCboModulo = SoloFun_CargaCombo($ArrModu,"CmbModulo","$CboDisabled",$itemselec," class='SoloStyle_Texto' style='width:200' onChange='Sumitirform();'","");

/******************Inicio de Consulta Transacciones***********************/
$bandT = false;
$strSql = "select * from solotb_modulo_transaccion ";
//echo "cmbmodulo:".$_REQUEST["CmbModulo"]."ad1";
if ($itemselec != "")
    $strSql .= " where co_modu=" . $itemselec;
else
    $strSql .= " where co_modu=" .$ArrModu[0][0];

$CboNodo = 1;
$strSql .= " and nodo= ". $CboNodo;
if ($_REQUEST["OpbTipo"] == "P")
    $strSql .= " and ds_tran like '" . $_REQUEST["txtTransaccion"] . "%'";
//'rw "",strsql
//'re

//'$strSql .= " order by co_tran"
//'response.write "<br>strSqlmodulot = " & strSql
//'re
SoloFun_ExecSql ($strSql, $arrData);
//   'for i=0 to cint(ubound(ArrData,2))
//    'for j=0 to ubound(ArrData,1)
//	'    response.write ArrData(j,i)& "- "
//	'next
//	'response.write "<br>"
//'next

$bandT = true;

$strSql = "select (max(co_tran)+1) as id  from solotb_modulo_transaccion";
if (!empty($_REQUEST["CmbModulo"]))
    $strSql .= " where co_modu =" . $_REQUEST["CmbModulo"];
else
    $strSql .= " where co_modu =" . $ArrModu[0][0];

$strSql .= " and nodo= ". $CboNodo;
//'   response.write "<br><br>strSql valor ="&strSql
//'   re
$oConexion = new Conexion($WORKFLOW["motor_base"], $WORKFLOW["db_usuario"], $WORKFLOW["db_password"], $WORKFLOW["basedatos"], $WORKFLOW["servidor"], $WORKFLOW["flags"], $WORKFLOW["encoding"]);
if(!$oConexion->EjecutarQuery($strSql)) {
    $strERROR = 1;
    $err = 0;
    echo $strSql."<br>";
    echo $oConexion->getErrorMessage();
}else {
    $MaxId = $oConexion->getData("NUM");
    $MaxId = $MaxId[0][0];
    //'   response.write "<br><br>MaxId ="&MaxId
    if (is_null($MaxId)) {
        $valcombo = $Modulo1;
        if (!empty($_REQUEST["CmbModulo"])) $valcombo = $_REQUEST["CmbModulo"];
        if ($valcombo == 0) $valcombo = 1;
        //'			response.write "<br>valor = " & valcombo
        $MaxId = $valcombo*100+1;
        //'			 response.write "<br>is null = " & MaxId & " cbo = " & $_REQUEST["CmbModulo")
    }
    $oConexion->liberarResultado();
}
//'			 response.write "<br>max = " & MaxId
$oConexion->Cerrar();
//'	     response.write MaxId & "--------" & strSQL

?>
<html>
    <head>
        <title>SoloPortal - Administrar Transacciones</title>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
        <link rel="stylesheet" href="SoloStyles/Solostyles.css" type="text/css">
        <SCRIPT type="text/JavaScript" src="Includes/Solofun_generales.js"></SCRIPT>
    </head>

    <body topmargin="0" leftmargin="0" onkeydown="checkKey();">

        <p align="center" class="SoloStyle_TituloPaginas">Administrar Opciones </p>
        <form name="frm" action="solotrn_AdministrarTransaccion.php" method="POST">
            <!-- TABLA DE CONSULTA INICIA -->
            <table border="0" width="60%" align="center" cellpadding="2" cellspacing="1" bordercolor="#CCCCCC">
                <tr>
                    <td>
                        <img src="iconos/soloico_nuevo.gif" border="1" alt="Ingresar Nuevo Registro" style="cursor:hand" onClick="SoloWindows('solotrn_GrabarTransaccion.php?opc=I&id1=<?php echo $itemselec;?>&id2=<?php echo $MaxId;?>&CboNodo=<?php echo $CboNodo;?>&itemselec=<?php echo $itemselec;?>',200,200,450,350);" >
                        <img src="iconos/soloico_buscar.gif" border="1" alt="Buscar" style="cursor:hand" onClick="document.frm.submit();">
                    </td>
            </table>
            <table border=1 width="60%" align="center" cellpadding="2" cellspacing="1" bordercolor="#CCCCCC">
                <tr>
                    <td class="SoloStyle_Etiqueta">Subsecretar&iacute;a/Dir. Provincial</td>
                    <td class="SoloStyle_EtiquetaCajas"><?php echo $StrCboNodo; ?></td>
                </tr>
                <tr>
                    <td class="SoloStyle_Etiqueta">M&oacute;dulo</td>
                    <td class="SoloStyle_EtiquetaCajas"><?php echo $StrCboModulo; ?></td>
                </tr>
                <tr>
                    <td class="SoloStyle_Etiqueta">Criterio </td>
                    <td class="SoloStyle_EtiquetaCajas">
                        <input type="radio" name="OpbTipo2" value="G" checked onClick="document.all.OpbTipo.checked=0;">
                        General <input type="radio" name="OpbTipo" value="P" onClick="document.all.OpbTipo2.checked=0;">
                        Descripci&oacute;n
                        <input type="text" maxlenght="14" size="35" name="txtTransaccion" class="SoloStyle_Texto" onFocus="document.all.OpbTipo.value='P';document.all.OpbTipo.checked=1;document.all.OpbTipo2.checked=0;">
                    </td>
                </tr>
            </table>
            <!-- TABLA DE CONSULTA FINALIZA -->
            <input type="hidden" name="HidId1" class="texto" value="<?php echo $MaxId;?>">
            <input type="hidden" name="opc" class="texto" value="G" size="5">
        </form>
        <table width="80%" border="1" align="center" bordercolor="#CCCCCC" cellpadding="0" cellspacing="1">
            <tr class="SoloStyle_Etiqueta">
                <td width="10%" height=25>Id Mod</td>
                <td width="10%" height=25>Id Prg</td>
                <td width="60%" height=25>Descripci&oacute;n</td>
                <td width="20%">Acciones</td>
            </tr>
            <?php
            if ($bandT) {
                for ($i=0; $i < count($arrData); $i++) {
                    $clase = "SoloStyle_texto";
                    if ($i%2 == 0) $clase = "SoloStyle_grid";
                    ?>
            <tr class="<?php echo $clase;?>">
                <td><?php echo $arrData[$i][0];?></td>
                <td><?php echo $arrData[$i][1];?></td>
                <td><?php echo $arrData[$i][2];?></td>
                <td><a href="javascript:SoloWindows('solotrn_GrabarTransaccion.php?id1=<?php echo $arrData[$i][0];?>&itemselec=<?php echo $itemselec?>&opc=M&id2=<?php echo $arrData[$i][1];?>&ds1=<?php echo $arrData[$i][2];?>&ds2=<?php echo str_replace("|", "'", $arrData[$i][3]);?>&id3=<?php echo $CboNodo;?>&CboNodo=<?php echo $CboNodo?>&xtxtOrden=<?php echo $arrData[$i][5];?>',200,200,450,350);"><img src="iconos/soloico_modificar.gif" alt="Modificar" border="0"></a>
                    &nbsp;
                    <a href="javascript:SoloFun_Confirm('solotrn_GrabarTransaccion.php?id1=<?php echo $arrData[$i][0];?>&id2=<?php echo $arrData[$i][1];?>&ds1=<?php echo $arrData[$i][2];?>&ds2=<?php echo $arrData[$i][3];?>&opc=E&id3=<?php echo $CboNodo;?>&CboNodo=<?php echo $CboNodo;?>&itemselec=<?php echo $arrData[$i][0];?>&xtxtOrden=<?php echo $arrData[$i][5];?>','Esta seguro que desea eliminar la transaccion?');"><img src="iconos/soloico_eliminar.gif" alt="Eliminar" border="0"></a></td>
            </tr>
                    <?php }
            }
            ?>
        </table>
    </body>
</html>

<script type="text/JavaScript">
    function Sumitirform(){
        document.frm.action = 'solotrn_AdministrarTransaccion.php';
        //		alert(document.all.txtform.value);
        frm.submit();
    }
    function MarcarNoMostrar(){
        if(document.all.chkNoMostrar.checked==true){
            document.all.ATxtProg.value='';
            document.all.ATxtProg.disabled=true;
        }
        else{
            document.all.ATxtProg.disabled=false;
        }
    }
</script>
<?php
include "Includes/soloFun_ShowMessages.php";
?>